<template>
  <div class="left-bottom-button" @click="click">
    <transition name="el-zoom-in-top">
      <el-tooltip v-show="showMore" v-if="isUpdate===true" class="item" effect="dark" content="退出更新模式" placement="top">
        <el-button type="danger" icon="el-icon-s-fold" class="left-main" style="font-size: 23px" @click="toReset" />
      </el-tooltip>

    </transition>
    <transition name="el-zoom-in-top">
      <el-tooltip v-show="showMore" v-if="isCheck===true" class="item" effect="dark" content="本地打开" placement="top">
        <el-button type="warning" icon="el-icon-folder" class="left-main" style="font-size: 23px" @click="openMd" />
      </el-tooltip>
    </transition>
    <!--开始时的展示-->
    <el-tooltip v-show="!showMore" class="item" effect="dark" content="操作" placement="top">
      <el-button v-show="!showMore" type="primary" icon="el-icon-more" class="left-main" />
    </el-tooltip>
    <el-tooltip v-show="showMore" class="item" effect="dark" content="操作" placement="top">
      <el-button v-show="showMore" type="success" icon="el-icon-more" class="left-main" />
    </el-tooltip>
  </div>
</template>

<script>
import urls from '../../router/urls'
import { openMdFIleLocal } from '@/api/table'

export default {
  name: 'FloatWindow',
  // id 记录当前文章的id号
  // type 表示悬浮窗模式
  // isUpdate 表示是否处于更新状态
  props: ['id', 'isCheck', 'isUpdate'],
  data: function() {
    return {
      showMore: false
    }
  },
  methods: {
    click() {
      this.showMore = !this.showMore
    },
    toEdit() {
      window.open(urls.controlPart.editArticle + '?articleId=' + this.id, '_blank')
    },
    toReset() {
      this.$emit('reset')
    },
    openMd() {
      openMdFIleLocal(this.id).then(() => {
        this.$message.success('打开成功！')
      })
    }
  }
}
</script>

<style scoped>
.left-bottom-button {
  position: absolute;
  bottom: 140px;
  right: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 9999;
}
.left-bottom-button .left-main {
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  border-radius: 50%;
  font-size: 19px;
  height: 50px;
  width: 50px;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  margin-bottom: 20px;
  margin-left: 20px !important;
}
</style>
